Delete user account fix and test

jamesperet 9 years ago
parent
commit
3176bf9860
3 changed files with 13 additions and 5 deletions
  1. 1 1
      app/views/devise/registrations/edit.html.erb
  2. 1 1
      config/routes.rb
  3. 11 3
      features/user_account.feature

+ 1 - 1
app/views/devise/registrations/edit.html.erb

@@ -48,7 +48,7 @@
48 48
 			  <div class="form-actions" style="margin: 0px; margin-top: 15px;">
49 49
 			    <%= f.submit  (t 'registration.update') %>
50 50
 			    <%= link_to (t 'nav.back'), :back, class: 'btn btn-link' %>
51
-			    <%= link_to ('<i class="fa fa-exclamation-triangle"></i> '+(t 'registration.cancel_account')).html_safe, registration_path(resource_name), data: { confirm: (t 'registration.cancel_confirmation') }, method: :delete, class: 'btn btn-danger pull-right' %>
51
+			    <%= link_to ('<i class="fa fa-exclamation-triangle"></i> '+(t 'registration.cancel_account')).html_safe, delete_user_account_path, data: { confirm: (t 'registration.cancel_confirmation') }, method: :delete, class: 'btn btn-danger pull-right', id: "delete_account" %>
52 52
 			  </div>
53 53
 		     </div>
54 54
 		 </div>

+ 1 - 1
config/routes.rb

@@ -56,7 +56,7 @@ RailsWebsiteTemplate::Application.routes.draw do
56 56
         get '/settings' => 'devise/registrations#edit',   as: 'edit_user_registration'
57 57
         put '/settings' => 'users/registrations#update', as: 'update_user_registration'
58 58
         # account deletion
59
-        delete '' => 'devise/registrations#destroy'
59
+        delete 'delete_account' => 'devise/registrations#destroy', :as => :delete_user_account
60 60
     end
61 61
   end
62 62
   

+ 11 - 3
features/user_account.feature

@@ -88,8 +88,7 @@ Feature: User Account
88 88
 		And I go to the login page
89 89
 		And I log in with the email "monty_cantsin@canada.com" and password "87654321"
90 90
 		Then I should see "Signed in successfully"
91
-	
92
-	@focus	
91
+		
93 92
 	Scenario: Change User Avatar
94 93
 		Given the user "Monty" "Cantsin" with email "monty_cantsin@canada.com" and password "12345678" exists
95 94
 		And I go to the login page
@@ -98,4 +97,13 @@ Feature: User Account
98 97
 		When I upload the file "avatar.jpg" to the field "user_avatar"
99 98
 		And I click in the button "Update"
100 99
 		And I click in the link "Account"
101
-		Then I should see the image "avatar.jpg"
100
+		Then I should see the image "avatar.jpg"
101
+		
102
+	Scenario: Delete user account
103
+		Given the user "Monty" "Cantsin" with email "monty_cantsin@canada.com" and password "12345678" exists
104
+		And I go to the login page
105
+		And I log in with the email "monty_cantsin@canada.com" and password "12345678"
106
+		And I click in the link "Account"
107
+		When I click in the link "Delete Account"
108
+		Then I should see "Bye! Your account was successfully cancelled. We hope to see you again soon."
109
+